package com.essence.common.model.parser;

import com.essence.common.model.Packet;
import io.netty.buffer.ByteBuf;

/**
 * C_SC_TA_1 带时标单点遥控
 */
public class CScTaParser extends ByteBufParser {
    @Override
    void parse(Packet packet, ByteBuf buf) {
        int infoAdr = buf.readUnsignedMediumLE();
        byte qb = buf.readByte();
        byte[] cp56Time2aBytes = new byte[7];
        buf.readBytes(cp56Time2aBytes);
        Packet.CP56Time2a cp56Time2a = new Packet.CP56Time2a(cp56Time2aBytes);
        Packet.DigitalSignals digitalSignals = new Packet.DigitalSignals(infoAdr, qb, 1, cp56Time2a);
        packet.addDigitalSignals(digitalSignals);
    }

    @Override
    int infoObjectLength() {
        return 11;
    }
}
